package com.zhengx.wifip2phelper

import android.net.NetworkInfo
import android.net.wifi.p2p.WifiP2pDevice
import android.net.wifi.p2p.WifiP2pGroup
import android.net.wifi.p2p.WifiP2pInfo


/**
 * name：
 * class: wifi p2p 回调接口
 * author: zhengx
 * create_time: 2018/11/8
 */

/**
* wifi p2p 状态改变监听器
* */
interface WifiStatusChangeListener {

    /**
     * wifi状态改变
     *
    WifiManager.WIFI_STATE_ENABLED -> {
    "已开启"
    }

    WifiManager.WIFI_STATE_DISABLED -> {
    "已关闭"
    }

    WifiManager.WIFI_STATE_ENABLING -> {
    "开启中"

    }

    WifiManager.WIFI_STATE_DISABLING -> {
    "关闭中"
    }

    else -> {
    "未知"
    }
     * */
    fun onWifiStateChange(previous: Int, nowState: Int)
    /**
     * wifi p2p可用的回调
     * */
    fun onWifiP2PEnable()
    /**
     * wifi p2p不可用的回调
     * */
    fun onWifiP2PDisable()
    /**
     * 在这里调用wifip2pmanager的 requestPeers方法
     * */
    fun onRequestPeers()
    /**
     * p2p设备列表刷新通知
     * */
    fun onUpdatePeers(devices: List<WifiP2pDevice>)
    /**
     * 设备自身状态改变的回调
     * */
    fun onThisChange(device: WifiP2pDevice)
    /**
     * wifi p2p连接状态改变的回调
     * */
    fun onConnectStateChange(wifiP2pGroup: WifiP2pGroup, wifiP2pInfo: WifiP2pInfo,
                             networkInfo: NetworkInfo)
    /**
     * wifi p2p连接结果回调
     * */
    fun onConnectResult(success: Boolean)
    /**
     * wifi p2p扫描状态改变
     * */
    fun onDiscoverChange(isConnected: Boolean)
}

/**
* 扫描开启关闭返回结果的回调
* */
interface DiscoverListener {
    fun onDiscoverStart(startResult: Boolean, reason: Int)
    fun onStopDiscovery(stopResult: Boolean, reason: Int)
}